package com.rr.serviceImpl;

import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import rr.pojo.UserAddress;
import rr.service.OrderService;
import rr.service.UserService;

import java.util.List;

/**
 * @author : RENBIAO
 * @createTime : 2021/7/8 19:10
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    UserService userService;

    /**
     * 根据用户ID，查找用户收货地址信息
     **/
    @Override
    public void initOrder(String userId) {

        //查询用户收货地址：远程调用
        List<UserAddress> userAddressList = userService.getUserAddressList(userId);
        System.out.println(userAddressList);
        for (UserAddress userAddress : userAddressList) {
            System.out.println(userAddress);
            System.out.println(JSON.toJSONString(userAddress));
        }
    }
}